import java.net.InetSocketAddress;
import java.util.Set;

/**
 * This class of objects is used to tell the rest of the group
 * that a new peer joined at our site. Made as a static class to
 * avoid the serialization considers the outer class.
 */
class JoinRelayMessage extends MulticastMessageTotal {
    private InetSocketAddress addressOfJoiner;
    public JoinRelayMessage(InetSocketAddress sender, InetSocketAddress joiner, int _clock) {
        super(sender,null,_clock);
        addressOfJoiner = joiner;
    }
    /**
     * @return The address of the peer who originally sent the
     *         join request message that resulted in this join
     *         message.
     */
    public InetSocketAddress getAddressOfJoiner() {
        return addressOfJoiner;
    }

    public String toString() {
        return "(JoinRelayMessage for " + getAddressOfJoiner() +
                " from " + getSender() + ")";
    }
}